﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace IrisGenerator.Framework.Database
{
    public static class SqlConvert
    {
        public static string ToString(object dataToConvert)
        {
            if (dataToConvert == null || Convert.IsDBNull(dataToConvert))
                return null;

            return Convert.ToString(dataToConvert);

        }

        public static bool? ToBoolean(object dataToConvert)
        {
            if (dataToConvert == null || Convert.IsDBNull(dataToConvert))
                return null;

            return Convert.ToBoolean(dataToConvert);
        }

        public static Guid? ToGuid(object dataToConvert)
        {
            if (dataToConvert == null || Convert.IsDBNull(dataToConvert))
                return null;

            return new Guid(SqlConvert.ToString(dataToConvert));

        }
    }
}
